package codegen;

public class VarDescr extends AbstractDescr {

    private static final long serialVersionUID = 1L;
    protected int addr, level;
    protected AbstractDescr typ;

    public VarDescr(int address, AbstractDescr typ, int level) {
        super(typ.getSize());
        addr = address;
        this.level = level;
        this.typ = typ;
    }

    public int getAddr() {
        return addr;
    }

	public boolean isVar() {
		return false;
	}
	
    public AbstractDescr getType() {
        return typ;
    }

	/**
	 * @return das static-Level auf welchem die Variable definiert wurde
	 */
    public int getLevel() {
        return level;
    }

    public void print() {
        trace("VarDescr: " + addr + " size: " + size);
        typ.print();
        unindent();
    }

    @Override
    public String toString() {
        return "VarTyp: ["+ addr + "," + typ +  "]" + super.toString();
    }
}
